package datatypes.r2.foundation.impl;

import java.util.ArrayList;
import java.util.List;

import datatypes.r2.foundation.BL;
import datatypes.r2.foundation.COLL;
import datatypes.r2.quantities.INT;

/**
 * A collection of values which can be enumerated using an iterator.
 * 
 * @author Obama
 * 
 * @param <T>
 */
public class Collection<T> extends DataValue implements COLL<T> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<T> list = new ArrayList<T>();

	/**
	 * An indicator that the COLL has no elements. The return value may be null
	 * (when the collection itself is null, whether the collection is empty is
	 * not known).
	 */
	@Override
	public BL isEmpty() {

		return new Boolean(list.isEmpty());
	}

	/**
	 * An indicator that the COLL contains at least one item. The return value
	 * may be null (when the collection itself is null, whether the collection
	 * is empty is not known).
	 */
	@Override
	public BL notEmpty() {
		return new Boolean(!list.isEmpty());
	}

	/**
	 * The number of elements in the COLL. The return value may be null (when
	 * the collection itself is null, the number of items in the collection is
	 * not known).
	 */
	@Override
	public INT count() {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * An indicator that the COLL contains an item with the given item value
	 * using the equals property. If item is null, the return value will be
	 * null.
	 */
	@Override
	public BL contains(T item) {

		return new Boolean(list.contains(item));
	}

	public List<T> getList() {
		return list;
	}

}
